import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: '布局-状态栏',
    component: () => import('../views/LayOut.vue'),
    redirect: '/login',
    children: [
      {
        path: '/login',
        name: '登录界面',
        component: () => import('../views/login/Login.vue'),
      },
      {
        path: '/older',
        name: '养老-导航栏',
        component: () => import('../views/older/Older.vue'),
        redirect: '/older/home',
        children: [
          {
            path: '/older/home',
            name: '养老社区',
            component: () => import('../views/older/home/Home.vue'),
          },
          {
            path: '/older/information',
            name: '养老社交',
            component: () => import('../views/older/information/Information.vue'),
          },
          {
            path: '/older/personal',
            name: '养老我的',
            component: () => import('../views/older/personal/Personal.vue'),
          },
          {
            path: '/older/health',
            name: '健康监测',
            component: () => import('../views/older/health/Health.vue'),
          },
        ],
      },
    ],
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
